package com.hudongwx.godoffood.activity.Community_Activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.hudongwx.godoffood.R;

/**
 * 举报的界面
 */

public class ReportActivity extends AppCompatActivity {
    private RelativeLayout relativeLayout;
    private String TAG = "ReportActivity";
    private EditText editText;
    private RadioGroup radioGroup;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_report);

        editText= (EditText) findViewById(R.id.report_edit);
        relativeLayout = (RelativeLayout) findViewById(R.id.report_bg);
        relativeLayout.getBackground().setAlpha(220);
        radioGroup= (RadioGroup) findViewById(R.id.report_rg);
        //给radioGroup添加点击事件
        radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                int radioButtonId = group.getCheckedRadioButtonId();
                //如果是选择的其他按钮 就显示edittext
                if (radioButtonId==R.id.report_cb5){
                    editText.setVisibility(View.VISIBLE);
                }else {
                    editText.setVisibility(View.GONE);
                }
                
            }
        });

    }

    public void back(View view) {

        finish();
    }

    public void toast(View view) {

        if (editText.getVisibility()==View.VISIBLE&&!TextUtils.isEmpty(editText.getText())){
            Toast.makeText(this,"举报成功！",Toast.LENGTH_SHORT).show();
            finish();
        }else {
            Toast.makeText(this,"请输入举报内容！",Toast.LENGTH_SHORT).show();
        }


    }


}
